package homeWorkDay04;

public class text1demo {
    private int age;

    public  text1demo(){}

    public text1demo(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws IllegalAgeExceptionDemo{
        if (age<0||age>100){
      throw new IllegalAgeExceptionDemo("年龄超出范围"+age);
        }
        this.age = age;
    }

    @Override
    public String toString() {
        return "text1demo{" +
                "age=" + age +
                '}';
    }

}